﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using XStudio.XCRF.Data.Enums;
using XStudio.XCRF.Web.Common.Sessions;

namespace XStudio.XCRF.Web.Common.Skin
{
    /// <summary>
    /// 用户皮肤类
    /// </summary>
    public class MemberSkin
    {
        /// <summary>
        /// 用户类型
        /// </summary>
        public MemberTypes MemberType { get; set; }
        /// <summary>
        /// 主题名称
        /// </summary>
        public string SkinName { get; set; }
        /// <summary>
        /// 顶部标题栏颜色
        /// </summary>
        public string TopColor { get; set; }
        /// <summary>
        /// 所有皮肤
        /// </summary>
        private static Dictionary<MemberTypes, MemberSkin> _Skins;
        /// <summary>
        /// 获取所有皮肤
        /// </summary>
        public static Dictionary<MemberTypes, MemberSkin> Skins
        {
            get { return _Skins; }
        }
        /// <summary>
        /// 当前用户类型的主题
        /// </summary>
        public static MemberSkin CurrentSkin
        {
            get
            {
                MemberTypes? type = LoginSession.MemberType;
                if(type == null)
                    type = MemberTypes.Researcher;
                return _Skins[(MemberTypes)type];
            }
        }


        static MemberSkin()
        {
            _Skins = new Dictionary<MemberTypes, MemberSkin>();
            _Skins.Add(MemberTypes.Administrator,
                new MemberSkin
                {
                    MemberType = MemberTypes.Administrator,
                    SkinName = "webblue",
                    TopColor = "#5F7C95"
                });
            _Skins.Add(MemberTypes.Owner,
                new MemberSkin
                {
                    MemberType = MemberTypes.Owner,
                    SkinName = "sunset",
                    TopColor = "#A23706"
                });
            _Skins.Add(MemberTypes.Researcher,
                new MemberSkin
                {
                    MemberType = MemberTypes.Researcher,
                    SkinName = "hay",
                    TopColor = "#51B406"
                });
        }
    }
}